package com.pattern.observer.case02;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class Purchase02Controller {

    private final Purchase02Service purchase02Service;

    /**
     * 下单购买
     * <p>
     * 下单购买包含三个操作
     * 1、保存订单(主要业务)
     * 2、扣减库存
     * 3、创建下单日志
     *
     * @return
     */
    @GetMapping("purchase02")
    public String purchase() {
        return purchase02Service.purchase();
    }

}
